perm filename HALHED.OPL[HAL,HE]1 blob sn#122338 filedate 1974-10-03 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00004 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	.SBTTL  ASSEMBLY FLAGS
C00005 00003	routine calling and defining macros.
C00007 00004	Graph structure definitions
C00008 ENDMK
CāŠ—;
.SBTTL  ASSEMBLY FLAGS

;This macro gives the switch SW a default value VAL
       .MACRO STSW SW,VAL
       .IFNDF SW
	SW == VAL   ;if do not have a value already, give it one
       .ENDC
       .ENDM

	STSW  FLOAT,1	;0 => no floating point capacity

.SBTTL	DEFS -- standard definitions for HAL runtime routines

; PROGRAM DEFINITIONS

ERRTRP=4		;time out and error trap
ILGINS=10		;illegal instruction
CLKTRP=104		;clock trap
RUG=50000		;Restart of RUG
PS=177776		;processor status word
KBIS=177560		;keyboard input status
KBIR=177562		;keyboard input register
KBOS=177564		;keyboard output status
KBOR=177566		;keyboard output register
CLKCNT=172544		;clock counter
CLKSET=172542		;clock set register
CLKS=172540		;clock status

STRT11=500		;starting address of program
IBUF=150		;start of input buffer from 11
OBUF=160		;start of output buffer to 11 
HCOR=77776		;highest useable word in core


;REGISTER DEFINITIONS

PC=%7			;program counter
SP=%6			;stack pointer
RF=%5			;Display pointer
R4=%4			;Saved across procedure calls
R3=%3			;Saved across procedure calls
R2=%2			;Saved across procedure calls
R1=%1			;temp
R0=%0			;temp
AC5==%5			;Temp Floating point register
AC4==%4			; "      "       "      "
AC3==%3			; "      "       "      "
AC2==%2			; "      "       "      "
AC1==%1			; "      "       "      "
AC0==%0			; "      "       "      "

;MARK DEFINITIONS
MARK0 = 6400		;MARK 0
MARK1 = 6401		;MARK 1
MARK2 = 6402		;ETC.
MARK3 = 6403
MARK4 = 6404
MARK5 = 6405

;Arithmetic definitions
PLACES = 0		;Number of bits to the right of the radix point in fixed.
;routine calling and defining macros.
;Coded by RHT 9/74.

;This should be used at the start of routines which reference
;	parameters off the RF stack.  It gives the parameters
;	symbolic names for clarity of coding.
;For example,
;
;	ROUTINE FOO,<A,B>
;
;Goes to
;
;	A==4
;	B==2
;FOO:

       .MACRO ROUTINE ID,ARGS
           .IFNB ARGS
	    NNNN==0
	       .IRP II,<ARGS>		;Raise NNNN to twice the number of args.
		NNNN==NNNN+2
	       .ENDM
	       .IRP II,<ARGS>		;Assign each arg NNNN and decrease same.
		II == NNNN
		NNNN == NNNN-2
	       .ENDM
	   .ENDC
ID:
       .ENDM

;This is useful in calling rountines which reference parameters off
;	the RF stack.  It sets up the stack properly, but does not
;	save R0 or R1.

       .MACRO CALL ID,ARGS
	MOV	RF,-(SP)	;Save RF
	NNNN == 6400		;This is a MARK 0 instruction
	   .IFNB ARGS
	       .IRP II,<ARGS>
		MOV	II,-(SP);Push an argument
		NNNN == NNNN+1	;Make NNNN the next MARK instruction.
	       .ENDM
	   .ENDC
	MOV	#NNNN,-(SP)	;Push the mark instruction.
	MOV	SP,RF		;Set up the display in RF.
	JSR	PC,ID		;Call the routine
       .ENDM
;Graph structure definitions
;RHT 9/74

       .MACRO	XX SYM			;Just gives SYM the next number.
	SYM == II
	II == II+2
       .ENDM

;CELL LINKS
	II==0
	XX	DATUM
	XX	LINKF
	XX	LINKB

;GRAPH NODES
	II==0
	XX	NXTGN		;CHAIN OF ALL GNODES IN THE WORLD
	XX	PRVGN
	XX	INVMRK		;USED AS FLAG
	XX	GNVAL		;POINTER AT VALUE
	XX	GNDEPS		;DEPENDENT GRAPH NODES
	XX	GNCLCS		;CALCULATOR LIST (DBL LINKED)
	XX	GNCHGS		;CHANGE LIST

;CALCULATOR CELL
	II==0
	XX	NXTCLC		;LIST LINK
	XX	NEEDED		;LIST OF NEEDED NODES
	XX	FORM		;SOME SORT OF CODE TO EVAL

;CHANGER CELL
	II==0
	XX	NXTCHG
	XX	CHGCOD